#include "Group.h"
#include "Meld.h"
#include "Card.h"
#include "Set.cpp"
#include "SetIter.cpp"
#include <iostream>
#include <string>

using std::ostream;
using std::cout;
using std::endl;
using std::string;

Group:: Group(){
}
Group:: Group(Set<Card> aSet){
  cardSet = aSet;
}

Group:: Group(const Group& copyGroup){
  cardSet = copyGroup.getCardSet();
}

Group:: Group(const Meld& copyMeld){
  cardSet = Set<Card>(copyMeld.getCardSet());
}

Group:: ~Group(){
}

Set<Card> Group::getValidCards(){
  SetIter<Card> thisIter(cardSet);
  
  Card thisCard;
  int suitNum = 10;
  while(thisIter.hasNext()){
    thisCard = thisIter.next();
    suitNum = suitNum - thisCard.suit-1; 
  }
  if(suitNum!=0)
    return Set<Card>(Card(thisCard.face,suitNum-1));
  else
    return Set<Card>();
}

//Checkers
bool Group::isValid() const{
  return validify()==-1;
}

